package ModelLayer;
import java.util.ArrayList;

public class Loan
{
    // instance variables - replace the example below with your own
    private String date;
    private int periode;
    private boolean status;
    private long id;
    private Addressbook addressbook;
    private DvdContainer dvdList;
    private long dvdId;
    private long sampleSerial;
    private long personId;

    public Loan(String date, int periode, boolean status, long id, long personId, long dvdId, long sampleSerial)
    {
        this.date = date;
        this.periode = periode;
        this.status = status;
        this.id = id;
        this.personId = personId;
        this.dvdId = dvdId;
        this.sampleSerial = sampleSerial;
        addressbook = addressbook.getInstance();
        dvdList = dvdList.getInstance();
    }

    public long getId()
    {
        return id;
    }
    
    //Print method
    public void getInfo()
    {
        System.out.println("ID: "+id);
        System.out.println("Status: "+status);
        System.out.println("Date: "+date);
        System.out.println("Periode: "+periode);
        System.out.println();
        System.out.println("Dvd Info:");
        addSample(dvdId, sampleSerial);
        System.out.println("");
        System.out.println("Person Info: ");
        addPerson(personId);
        
    }
    
    //Changes the attributes of the Loan class
    public void changeInfo(String date, int periode, boolean status, long id)
    {
        this.date = date;
        this.periode = periode;
        this.status = status;
        this.id = id;
    }
    
    //Calls the getPerson() method on Person
    private void addPerson(long personId)
    {
        long id = personId;
        addressbook.getPerson(id);
    }
    
    //A getSample info method
    private void addSample(long dvdId, long sampleSerial)
    {
        long id = dvdId;
        long serialNo = sampleSerial;
        dvdList.getDvdInfo(id);
        dvdList.getSample(id, serialNo);
    }
}
